home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / libIDL-2.0 / libIDL / IDL.h
Encoding:
C/C++ Source or Header  |  2005-10-18  |  24.1 KB  |  876 lines

  1. /**************************************************************************
  2.  
  3.     IDL.h (IDL parse tree and namespace components)
  4.  
  5.     Copyright (C) 1998, 1999 Andrew T. Veliath
  6.  
  7.     This library is free software; you can redistribute it and/or
  8.     modify it under the terms of the GNU Library General Public
  9.     License as published by the Free Software Foundation; either
  10.     version 2 of the License, or (at your option) any later version.
  11.  
  12.     This library is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.     Library General Public License for more details.
  16.  
  17.     You should have received a copy of the GNU Library General Public
  18.     License along with this library; if not, write to the Free
  19.     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21.     $Id: IDL.h.in,v 1.31 2003/04/12 08:38:27 msakai Exp $
  22.  
  23. ***************************************************************************/
  24. #ifndef __IDL_H
  25. #define __IDL_H
  26.  
  27. #include <glib.h>
  28.  
  29. /* Try to find wchar_t support */
  30. #include <stdlib.h>
  31. #if 1 /* HAVE_WCHAR_H */
  32. #  include <wchar.h>
  33. #endif
  34. #if 0 /* HAVE_WCSTR_H */
  35. #  include <wcstr.h>
  36. #endif
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41.  
  42. #include <stdio.h>
  43.  
  44. /* version */
  45. #define LIBIDL_GEN_VERSION(a,b,c)    (((a) << 16) + ((b) << 8) + (c))
  46. #define LIBIDL_MAJOR_VERSION        0
  47. #define LIBIDL_MINOR_VERSION        8
  48. #define LIBIDL_MICRO_VERSION        6
  49. #define LIBIDL_VERSION_CODE        LIBIDL_GEN_VERSION(0,8,6)
  50.  
  51. /* miscellaneous constants */
  52. #define IDL_SUCCESS            0
  53. #define IDL_ERROR            1
  54. #define IDL_WARNING1            2
  55. #define IDL_WARNING2            3
  56. #define IDL_WARNING3            4
  57. #define IDL_WARNINGMAX            IDL_WARNING3
  58.  
  59. /* general parse flags */
  60. #define IDLF_VERBOSE            (1UL << 0)
  61. #define IDLF_NO_EVAL_CONST        (1UL << 1)
  62. #define IDLF_COMBINE_REOPENED_MODULES    (1UL << 2)
  63. #define IDLF_PREFIX_FILENAME        (1UL << 3)
  64. #define IDLF_IGNORE_FORWARDS        (1UL << 4)
  65. #define IDLF_PEDANTIC            (1UL << 5)
  66. #define IDLF_INHIBIT_TAG_ONLY        (1UL << 6)
  67. #define IDLF_INHIBIT_INCLUDES        (1UL << 7)
  68. #define IDLF_SHOW_CPP_ERRORS        (1UL << 8)
  69.  
  70. /* syntax extension parse flags */
  71. #define IDLF_TYPECODES            (1UL << 16)
  72. #define IDLF_XPIDL            (1UL << 17)
  73. #define IDLF_PROPERTIES            (1UL << 18)
  74. #define IDLF_CODEFRAGS            (1UL << 19)
  75. #define IDLF_SRCFILES            (1UL << 20)
  76.  
  77. /* declaration specification flags */
  78. #define IDLF_DECLSPEC_EXIST        (1UL << 0)
  79. #define IDLF_DECLSPEC_INHIBIT        (1UL << 1)
  80. #define IDLF_DECLSPEC_PIDL        (1UL << 2)
  81.  
  82. /* output flags */
  83. #define IDLF_OUTPUT_NO_NEWLINES        (1UL << 0)
  84. #define IDLF_OUTPUT_NO_QUALIFY_IDENTS    (1UL << 1)
  85. #define IDLF_OUTPUT_PROPERTIES        (1UL << 2)
  86. #define IDLF_OUTPUT_CODEFRAGS        (1UL << 3)
  87.  
  88. #ifdef G_PLATFORM_WIN32
  89. #  define IDL_EXPORT            /* assume auto-export */
  90. #  define IDL_IMPORT            __declspec (dllimport)
  91. #else
  92. #  define IDL_EXPORT            /* empty */
  93. #  define IDL_IMPORT            extern
  94. #endif
  95.  
  96. /* type casting checks */
  97. #define IDL_check_cast_enable(boolean)    do {    \
  98.     IDL_IMPORT int __IDL_check_type_casts;    \
  99.     __IDL_check_type_casts = (boolean);    \
  100. } while (0)
  101. #define IDL_CHECK_CAST(tree, thetype, name)            \
  102.     (IDL_check_type_cast(tree, thetype,            \
  103.                 __FILE__, __LINE__,            \
  104.                 G_GNUC_PRETTY_FUNCTION)->u.name)
  105.  
  106. /* GLib 2.0 requires 64-bit types */
  107. #define IDL_LL        "ll"
  108. typedef gint64        IDL_longlong_t;
  109. typedef guint64        IDL_ulonglong_t;
  110.  
  111. typedef unsigned int            IDL_declspec_t;
  112. typedef struct _IDL_tree_node         IDL_tree_node;
  113. typedef struct _IDL_tree_node *        IDL_tree;
  114.  
  115. struct _IDL_LIST {
  116.     IDL_tree data;
  117.     IDL_tree prev;
  118.     IDL_tree next;
  119.     IDL_tree _tail;            /* Internal use, may not be valid */
  120. };
  121.   
  122. #define IDL_LIST(a)            IDL_CHECK_CAST(a, IDLN_LIST, idl_list)
  123. extern IDL_tree        IDL_list_new            (IDL_tree data);
  124. extern IDL_tree        IDL_list_concat            (IDL_tree orig,
  125.                              IDL_tree append);
  126. extern IDL_tree        IDL_list_remove            (IDL_tree list,
  127.                              IDL_tree p);
  128. extern int        IDL_list_length            (IDL_tree list);
  129. extern IDL_tree        IDL_list_nth            (IDL_tree list,
  130.                              int n);
  131.  
  132. struct _IDL_GENTREE {
  133.     IDL_tree data;
  134.     GHashTable *siblings;
  135.     GHashTable *children;
  136.     GHashFunc hash_func;
  137.     GCompareFunc key_compare_func;
  138.     IDL_tree _import;        /* Internal use, do not recurse */
  139.     char *_cur_prefix;        /* Internal use */
  140. };
  141. #define IDL_GENTREE(a)            IDL_CHECK_CAST(a, IDLN_GENTREE, idl_gentree)
  142. extern IDL_tree        IDL_gentree_new            (GHashFunc hash_func,
  143.                              GCompareFunc key_compare_func,
  144.                              IDL_tree data);
  145. extern IDL_tree        IDL_gentree_new_sibling        (IDL_tree from,
  146.                              IDL_tree data);
  147. extern IDL_tree        IDL_gentree_chain_sibling    (IDL_tree from,
  148.                              IDL_tree data);
  149. extern IDL_tree        IDL_gentree_chain_child        (IDL_tree from,
  150.                              IDL_tree data);
  151.  
  152. struct _IDL_INTEGER {
  153.     IDL_longlong_t value;
  154. };
  155. #define IDL_INTEGER(a)            IDL_CHECK_CAST(a, IDLN_INTEGER, idl_integer)
  156. extern IDL_tree        IDL_integer_new            (IDL_longlong_t value);
  157.  
  158. struct _IDL_STRING {
  159.     char *value;
  160. };
  161. #define IDL_STRING(a)            IDL_CHECK_CAST(a, IDLN_STRING, idl_string)
  162. extern IDL_tree        IDL_string_new            (char *value);
  163.  
  164. struct _IDL_WIDE_STRING {
  165.     wchar_t *value;
  166. };
  167. #define IDL_WIDE_STRING(a)        IDL_CHECK_CAST(a, IDLN_WIDE_STRING, idl_wide_string)
  168. extern IDL_tree        IDL_wide_string_new        (wchar_t *value);
  169.  
  170. struct _IDL_CHAR {
  171.     char *value;
  172. };
  173. #define IDL_CHAR(a)            IDL_CHECK_CAST(a, IDLN_CHAR, idl_char)
  174. extern IDL_tree        IDL_char_new            (char *value);
  175.  
  176. struct _IDL_WIDE_CHAR {
  177.     wchar_t *value;
  178. };
  179. #define IDL_WIDE_CHAR(a)        IDL_CHECK_CAST(a, IDLN_WIDE_CHAR, idl_wide_char)
  180. extern IDL_tree        IDL_wide_char_new        (wchar_t *value);
  181.  
  182. struct _IDL_FIXED {
  183.     char *value;
  184. };
  185. #define IDL_FIXED(a)            IDL_CHECK_CAST(a, IDLN_FIXED, idl_fixed)
  186. extern IDL_tree        IDL_fixed_new            (char *value);
  187.  
  188. struct _IDL_FLOAT {
  189.     double value;
  190. };
  191. #define IDL_FLOAT(a)            IDL_CHECK_CAST(a, IDLN_FLOAT, idl_float)
  192. extern IDL_tree        IDL_float_new            (double value);
  193.  
  194. struct _IDL_BOOLEAN {
  195.     unsigned value;
  196. };
  197. #define IDL_BOOLEAN(a)            IDL_CHECK_CAST(a, IDLN_BOOLEAN, idl_boolean)
  198. extern IDL_tree        IDL_boolean_new            (unsigned value);
  199.  
  200. struct _IDL_IDENT {
  201.     char *str;
  202.     char *repo_id;
  203.     GSList *comments;
  204.     IDL_tree _ns_ref;        /* Internal use, do not recurse */
  205.     unsigned _flags;        /* Internal use */
  206. #define IDLF_IDENT_CASE_MISMATCH_HIT    (1UL << 0)
  207. };
  208. #define IDL_IDENT(a)            IDL_CHECK_CAST(a, IDLN_IDENT, idl_ident)
  209. #define IDL_IDENT_TO_NS(a)        IDL_CHECK_CAST(a, IDLN_IDENT, idl_ident._ns_ref)
  210. #define IDL_IDENT_REPO_ID(a)        IDL_CHECK_CAST(a, IDLN_IDENT, idl_ident.repo_id)
  211. extern IDL_tree        IDL_ident_new            (char *str);
  212. extern void        IDL_queue_new_ident_comment    (const char *str);
  213.  
  214. enum IDL_float_type {
  215.     IDL_FLOAT_TYPE_FLOAT,
  216.     IDL_FLOAT_TYPE_DOUBLE,
  217.     IDL_FLOAT_TYPE_LONGDOUBLE
  218. };
  219.  
  220. struct _IDL_TYPE_FLOAT {
  221.     enum IDL_float_type f_type;
  222. };
  223. #define IDL_TYPE_FLOAT(a)        IDL_CHECK_CAST(a, IDLN_TYPE_FLOAT, idl_type_float)
  224. extern IDL_tree        IDL_type_float_new        (enum IDL_float_type f_type);
  225.  
  226. struct _IDL_TYPE_FIXED {
  227.     IDL_tree positive_int_const;
  228.     IDL_tree integer_lit;
  229. };
  230. #define IDL_TYPE_FIXED(a)        IDL_CHECK_CAST(a, IDLN_TYPE_FIXED, idl_type_fixed)
  231. extern IDL_tree        IDL_type_fixed_new        (IDL_tree positive_int_const,
  232.                              IDL_tree integer_lit);
  233.  
  234. enum IDL_integer_type {
  235.     IDL_INTEGER_TYPE_SHORT,
  236.     IDL_INTEGER_TYPE_LONG,
  237.     IDL_INTEGER_TYPE_LONGLONG
  238. };
  239.  
  240. struct _IDL_TYPE_INTEGER {
  241.     unsigned f_signed        : 1;
  242.     enum IDL_integer_type f_type;
  243. };
  244. #define IDL_TYPE_INTEGER(a)        IDL_CHECK_CAST(a, IDLN_TYPE_INTEGER, idl_type_integer)
  245. extern IDL_tree        IDL_type_integer_new        (unsigned f_signed,
  246.                              enum IDL_integer_type f_type);
  247.  
  248. extern IDL_tree        IDL_type_char_new        (void);
  249. extern IDL_tree        IDL_type_wide_char_new        (void);
  250. extern IDL_tree        IDL_type_boolean_new        (void);
  251. extern IDL_tree        IDL_type_octet_new        (void);
  252. extern IDL_tree        IDL_type_any_new        (void);
  253. extern IDL_tree        IDL_type_object_new        (void);
  254. extern IDL_tree        IDL_type_typecode_new        (void);
  255.  
  256. struct _IDL_TYPE_STRING {
  257.     IDL_tree positive_int_const;
  258. };
  259. #define IDL_TYPE_STRING(a)        IDL_CHECK_CAST(a, IDLN_TYPE_STRING, idl_type_string)
  260. extern IDL_tree        IDL_type_string_new        (IDL_tree positive_int_const);
  261.  
  262. struct _IDL_TYPE_WIDE_STRING {
  263.     IDL_tree positive_int_const;
  264. };
  265. #define IDL_TYPE_WIDE_STRING(a)        IDL_CHECK_CAST(a, IDLN_TYPE_WIDE_STRING, idl_type_wide_string)
  266. extern IDL_tree        IDL_type_wide_string_new    (IDL_tree positive_int_const);
  267.  
  268. struct _IDL_TYPE_ENUM {
  269.     IDL_tree ident;
  270.     IDL_tree enumerator_list;
  271. };
  272. #define IDL_TYPE_ENUM(a)        IDL_CHECK_CAST(a, IDLN_TYPE_ENUM, idl_type_enum)
  273. extern IDL_tree        IDL_type_enum_new        (IDL_tree ident,
  274.                              IDL_tree enumerator_list);
  275.  
  276. struct _IDL_TYPE_ARRAY {
  277.     IDL_tree ident;
  278.     IDL_tree size_list;
  279. };
  280. #define IDL_TYPE_ARRAY(a)        IDL_CHECK_CAST(a, IDLN_TYPE_ARRAY, idl_type_array)
  281. extern IDL_tree        IDL_type_array_new        (IDL_tree ident,
  282.                              IDL_tree size_list);
  283.  
  284. struct _IDL_TYPE_SEQUENCE {
  285.     IDL_tree simple_type_spec;
  286.     IDL_tree positive_int_const;
  287. };
  288. #define IDL_TYPE_SEQUENCE(a)        IDL_CHECK_CAST(a, IDLN_TYPE_SEQUENCE, idl_type_sequence)
  289. extern IDL_tree        IDL_type_sequence_new        (IDL_tree simple_type_spec,
  290.                              IDL_tree positive_int_const);
  291.  
  292. struct _IDL_TYPE_STRUCT {
  293.     IDL_tree ident;
  294.     IDL_tree member_list;
  295. };
  296. #define IDL_TYPE_STRUCT(a)        IDL_CHECK_CAST(a, IDLN_TYPE_STRUCT, idl_type_struct)
  297. extern IDL_tree        IDL_type_struct_new        (IDL_tree ident,
  298.                              IDL_tree member_list);
  299.  
  300. struct _IDL_TYPE_UNION {
  301.     IDL_tree ident;
  302.     IDL_tree switch_type_spec;
  303.     IDL_tree switch_body;
  304. };
  305. #define IDL_TYPE_UNION(a)        IDL_CHECK_CAST(a, IDLN_TYPE_UNION, idl_type_union)
  306. extern IDL_tree        IDL_type_union_new        (IDL_tree ident,
  307.                              IDL_tree switch_type_spec,
  308.                              IDL_tree switch_body);
  309. struct _IDL_MEMBER {
  310.     IDL_tree type_spec;
  311.     IDL_tree dcls;
  312. };
  313. #define IDL_MEMBER(a)            IDL_CHECK_CAST(a, IDLN_MEMBER, idl_member)
  314. extern IDL_tree        IDL_member_new            (IDL_tree type_spec,
  315.                              IDL_tree dcls);
  316.  
  317. struct _IDL_NATIVE {
  318.     IDL_tree ident;
  319.     char *user_type;        /* XPIDL extension */
  320. };
  321. #define IDL_NATIVE(a)            IDL_CHECK_CAST(a, IDLN_NATIVE, idl_native)
  322. extern IDL_tree        IDL_native_new            (IDL_tree ident);
  323.  
  324.  
  325. struct _IDL_TYPE_DCL {
  326.     IDL_tree type_spec;
  327.     IDL_tree dcls;
  328. };
  329. #define IDL_TYPE_DCL(a)            IDL_CHECK_CAST(a, IDLN_TYPE_DCL, idl_type_dcl)
  330. extern IDL_tree        IDL_type_dcl_new        (IDL_tree type_spec,
  331.                              IDL_tree dcls);
  332.  
  333. struct _IDL_CONST_DCL {
  334.     IDL_tree const_type;
  335.     IDL_tree ident;
  336.     IDL_tree const_exp;
  337. };
  338. #define IDL_CONST_DCL(a)        IDL_CHECK_CAST(a, IDLN_CONST_DCL, idl_const_dcl)
  339. extern IDL_tree        IDL_const_dcl_new        (IDL_tree const_type,
  340.                              IDL_tree ident,
  341.                              IDL_tree const_exp);
  342.  
  343. struct _IDL_EXCEPT_DCL {
  344.     IDL_tree ident;
  345.     IDL_tree members;
  346. };
  347. #define IDL_EXCEPT_DCL(a)        IDL_CHECK_CAST(a, IDLN_EXCEPT_DCL, idl_except_dcl)
  348. extern IDL_tree        IDL_except_dcl_new        (IDL_tree ident,
  349.                              IDL_tree members);
  350.  
  351. struct _IDL_ATTR_DCL {
  352.     unsigned f_readonly        : 1;
  353.     IDL_tree param_type_spec;
  354.     IDL_tree simple_declarations;
  355. };
  356. #define IDL_ATTR_DCL(a)            IDL_CHECK_CAST(a, IDLN_ATTR_DCL, idl_attr_dcl)
  357. extern IDL_tree        IDL_attr_dcl_new        (unsigned f_readonly,
  358.                              IDL_tree param_type_spec,
  359.                              IDL_tree simple_declarations);
  360.  
  361. struct _IDL_OP_DCL {
  362.     unsigned __f_noscript        : 1;    /* Deprecated */
  363.     unsigned f_oneway        : 1;
  364.     /* XPIDL extension (varags) */
  365.     unsigned f_varargs        : 1;
  366.     IDL_tree op_type_spec;
  367.     IDL_tree ident;
  368.     IDL_tree parameter_dcls;
  369.     IDL_tree raises_expr;
  370.     IDL_tree context_expr;
  371. };
  372. #define IDL_OP_DCL(a)            IDL_CHECK_CAST(a, IDLN_OP_DCL, idl_op_dcl)
  373. extern IDL_tree        IDL_op_dcl_new            (unsigned f_oneway,
  374.                              IDL_tree op_type_spec,
  375.                              IDL_tree ident,
  376.                              IDL_tree parameter_dcls,
  377.                              IDL_tree raises_expr,
  378.                              IDL_tree context_expr);
  379.  
  380. enum IDL_param_attr {
  381.     IDL_PARAM_IN,
  382.     IDL_PARAM_OUT,
  383.     IDL_PARAM_INOUT
  384. };
  385.  
  386. struct _IDL_PARAM_DCL {
  387.     enum IDL_param_attr attr;
  388.     IDL_tree param_type_spec;
  389.     IDL_tree simple_declarator;
  390. };
  391. #define IDL_PARAM_DCL(a)        IDL_CHECK_CAST(a, IDLN_PARAM_DCL, idl_param_dcl)
  392. extern IDL_tree        IDL_param_dcl_new        (enum IDL_param_attr attr,
  393.                              IDL_tree param_type_spec,
  394.                              IDL_tree simple_declarator);
  395.  
  396. struct _IDL_CASE_STMT {
  397.     IDL_tree labels;
  398.     IDL_tree element_spec;
  399. };
  400. #define IDL_CASE_STMT(a)        IDL_CHECK_CAST(a, IDLN_CASE_STMT, idl_case_stmt)
  401. extern IDL_tree        IDL_case_stmt_new        (IDL_tree labels,
  402.                              IDL_tree element_spec);
  403.  
  404. struct _IDL_INTERFACE {
  405.     IDL_tree ident;
  406.     IDL_tree inheritance_spec;
  407.     IDL_tree body;
  408. };
  409. #define IDL_INTERFACE(a)        IDL_CHECK_CAST(a, IDLN_INTERFACE, idl_interface)
  410. extern IDL_tree        IDL_interface_new        (IDL_tree ident,
  411.                              IDL_tree inheritance_spec,
  412.                              IDL_tree body);
  413.  
  414. struct _IDL_FORWARD_DCL {
  415.     IDL_tree ident;
  416. };
  417. #define IDL_FORWARD_DCL(a)        IDL_CHECK_CAST(a, IDLN_FORWARD_DCL, idl_forward_dcl)
  418. extern IDL_tree        IDL_forward_dcl_new        (IDL_tree ident);
  419.  
  420. struct _IDL_MODULE {
  421.     IDL_tree ident;
  422.     IDL_tree definition_list;
  423. };
  424. #define IDL_MODULE(a)            IDL_CHECK_CAST(a, IDLN_MODULE, idl_module)
  425. extern IDL_tree        IDL_module_new            (IDL_tree ident,
  426.                              IDL_tree definition_list);
  427.  
  428. enum IDL_binop {
  429.     IDL_BINOP_OR,
  430.     IDL_BINOP_XOR,
  431.     IDL_BINOP_AND,
  432.     IDL_BINOP_SHR,
  433.     IDL_BINOP_SHL,
  434.     IDL_BINOP_ADD,
  435.     IDL_BINOP_SUB,
  436.     IDL_BINOP_MULT,
  437.     IDL_BINOP_DIV,
  438.     IDL_BINOP_MOD
  439. };
  440.  
  441. struct _IDL_BINOP {
  442.     enum IDL_binop op;
  443.     IDL_tree left, right;
  444. };
  445. #define IDL_BINOP(a)            IDL_CHECK_CAST(a, IDLN_BINOP, idl_binop)
  446. extern IDL_tree        IDL_binop_new            (enum IDL_binop op,
  447.                              IDL_tree left,
  448.                              IDL_tree right);
  449.  
  450. enum IDL_unaryop {
  451.     IDL_UNARYOP_PLUS,
  452.     IDL_UNARYOP_MINUS,
  453.     IDL_UNARYOP_COMPLEMENT
  454. };
  455.  
  456. struct _IDL_UNARYOP {
  457.     enum IDL_unaryop op;
  458.     IDL_tree operand;
  459. };
  460. #define IDL_UNARYOP(a)            IDL_CHECK_CAST(a, IDLN_UNARYOP, idl_unaryop)
  461. extern IDL_tree        IDL_unaryop_new            (enum IDL_unaryop op,
  462.                              IDL_tree operand);
  463.  
  464. /* XPIDL code fragments extension. */
  465. struct _IDL_CODEFRAG {
  466.     char *desc;
  467.     GSList *lines;
  468. };
  469. #define IDL_CODEFRAG(a)            IDL_CHECK_CAST(a, IDLN_CODEFRAG, idl_codefrag)
  470. extern IDL_tree        IDL_codefrag_new        (char *desc,
  471.                              GSList *lines);
  472.  
  473. /* source/include file marking extension. */
  474. struct _IDL_SRCFILE {
  475.     char *filename;
  476.     int seenCnt;
  477.     gboolean isTop;
  478.     gboolean wasInhibit;
  479. };
  480. #define IDL_SRCFILE(a)            IDL_CHECK_CAST(a, IDLN_SRCFILE, idl_srcfile)
  481. extern IDL_tree        IDL_srcfile_new        (char *filename, int seenCnt, gboolean isTop, gboolean wasInhibit);
  482.  
  483. /*
  484.  * IDL_tree_type - Enumerations of node types
  485.  *
  486.  * Note this enumerator list is subject to change in the future. A program should not need
  487.  * more than a recompilation to adjust for a change in this list, so instead of using a
  488.  * statically initialized jumptable, allocate an array of size IDLN_LAST and assign the
  489.  * elements manually.
  490.  */
  491. typedef enum {
  492.     IDLN_NONE,
  493.     IDLN_ANY,
  494.  
  495.     IDLN_LIST,
  496.     IDLN_GENTREE,
  497.     IDLN_INTEGER,
  498.     IDLN_STRING,
  499.     IDLN_WIDE_STRING,
  500.     IDLN_CHAR,
  501.     IDLN_WIDE_CHAR,
  502.     IDLN_FIXED,
  503.     IDLN_FLOAT,
  504.     IDLN_BOOLEAN,
  505.     IDLN_IDENT,
  506.     IDLN_TYPE_DCL,
  507.     IDLN_CONST_DCL,
  508.     IDLN_EXCEPT_DCL,
  509.     IDLN_ATTR_DCL,
  510.     IDLN_OP_DCL,
  511.     IDLN_PARAM_DCL,
  512.     IDLN_FORWARD_DCL,
  513.     IDLN_TYPE_INTEGER,
  514.     IDLN_TYPE_FLOAT,
  515.     IDLN_TYPE_FIXED,
  516.     IDLN_TYPE_CHAR,
  517.     IDLN_TYPE_WIDE_CHAR,
  518.     IDLN_TYPE_STRING,
  519.     IDLN_TYPE_WIDE_STRING,
  520.     IDLN_TYPE_BOOLEAN,
  521.     IDLN_TYPE_OCTET,
  522.     IDLN_TYPE_ANY,
  523.     IDLN_TYPE_OBJECT,
  524.     IDLN_TYPE_TYPECODE,
  525.     IDLN_TYPE_ENUM,
  526.     IDLN_TYPE_SEQUENCE,
  527.     IDLN_TYPE_ARRAY,
  528.     IDLN_TYPE_STRUCT,
  529.     IDLN_TYPE_UNION,
  530.     IDLN_MEMBER,
  531.     IDLN_NATIVE,
  532.     IDLN_CASE_STMT,
  533.     IDLN_INTERFACE,
  534.     IDLN_MODULE,
  535.     IDLN_BINOP,
  536.     IDLN_UNARYOP,
  537.     IDLN_CODEFRAG,
  538.     IDLN_SRCFILE,
  539.  
  540.     IDLN_LAST
  541. } IDL_tree_type;
  542. IDL_IMPORT const char *            IDL_tree_type_names[];
  543.  
  544. struct _IDL_tree_node {
  545.     IDL_tree_type _type;
  546.     IDL_tree up;            /* Do not recurse */
  547.     IDL_declspec_t declspec;
  548.     GHashTable *properties;
  549.     int refs;
  550.     char *_file;            /* Internal use */
  551.     int _line;            /* Internal use */
  552.     union {
  553.         struct _IDL_LIST idl_list;
  554.         struct _IDL_GENTREE idl_gentree;
  555.         struct _IDL_INTEGER idl_integer;
  556.         struct _IDL_STRING idl_string;
  557.         struct _IDL_WIDE_STRING idl_wide_string;
  558.         struct _IDL_CHAR idl_char;
  559.         struct _IDL_WIDE_CHAR idl_wide_char;
  560.         struct _IDL_FIXED idl_fixed;
  561.         struct _IDL_FLOAT idl_float;
  562.         struct _IDL_BOOLEAN idl_boolean;
  563.         struct _IDL_IDENT idl_ident;
  564.         struct _IDL_TYPE_DCL idl_type_dcl;
  565.         struct _IDL_CONST_DCL idl_const_dcl;
  566.         struct _IDL_EXCEPT_DCL idl_except_dcl;
  567.         struct _IDL_ATTR_DCL idl_attr_dcl;
  568.         struct _IDL_OP_DCL idl_op_dcl;
  569.         struct _IDL_PARAM_DCL idl_param_dcl;
  570.         struct _IDL_FORWARD_DCL idl_forward_dcl;
  571.         struct _IDL_TYPE_FLOAT idl_type_float;
  572.         struct _IDL_TYPE_FIXED idl_type_fixed;
  573.         struct _IDL_TYPE_INTEGER idl_type_integer;
  574.         struct _IDL_TYPE_ENUM idl_type_enum;
  575.         struct _IDL_TYPE_STRING idl_type_string;
  576.         struct _IDL_TYPE_WIDE_STRING idl_type_wide_string;
  577.         struct _IDL_TYPE_SEQUENCE idl_type_sequence;
  578.         struct _IDL_TYPE_ARRAY idl_type_array;
  579.         struct _IDL_TYPE_STRUCT idl_type_struct;
  580.         struct _IDL_TYPE_UNION idl_type_union;
  581.         struct _IDL_MEMBER idl_member;
  582.         struct _IDL_NATIVE idl_native;
  583.         struct _IDL_CASE_STMT idl_case_stmt;
  584.         struct _IDL_INTERFACE idl_interface;
  585.         struct _IDL_MODULE idl_module;
  586.         struct _IDL_BINOP idl_binop;
  587.         struct _IDL_UNARYOP idl_unaryop;
  588.         struct _IDL_CODEFRAG idl_codefrag;
  589.         struct _IDL_SRCFILE idl_srcfile;
  590.     } u;
  591.  
  592.     /* Fields for application use */
  593.     guint32 flags;
  594.     gpointer data;
  595. };
  596. #define IDL_NODE_TYPE(a)        ((a)->_type)
  597. #define IDL_NODE_TYPE_NAME(a)        ((a)?IDL_tree_type_names[IDL_NODE_TYPE(a)]:"NULL")
  598. #define IDL_NODE_UP(a)            ((a)->up)
  599. #define IDL_NODE_PROPERTIES(a)        ((a)->properties)
  600. #define IDL_NODE_DECLSPEC(a)        ((a)->declspec)
  601. #define IDL_NODE_REFS(a)        ((a)->refs)
  602. #define IDL_NODE_IS_LITERAL(a)                \
  603.     (IDL_NODE_TYPE(a) == IDLN_INTEGER ||        \
  604.      IDL_NODE_TYPE(a) == IDLN_STRING ||        \
  605.      IDL_NODE_TYPE(a) == IDLN_WIDE_STRING ||    \
  606.      IDL_NODE_TYPE(a) == IDLN_CHAR ||        \
  607.      IDL_NODE_TYPE(a) == IDLN_WIDE_CHAR ||        \
  608.      IDL_NODE_TYPE(a) == IDLN_FIXED ||        \
  609.      IDL_NODE_TYPE(a) == IDLN_FLOAT ||        \
  610.      IDL_NODE_TYPE(a) == IDLN_BOOLEAN)
  611. #define IDL_NODE_IS_TYPE(a)                \
  612.     (IDL_NODE_TYPE(a) == IDLN_TYPE_INTEGER ||    \
  613.      IDL_NODE_TYPE(a) == IDLN_TYPE_STRING ||    \
  614.      IDL_NODE_TYPE(a) == IDLN_TYPE_WIDE_STRING ||    \
  615.      IDL_NODE_TYPE(a) == IDLN_TYPE_CHAR ||        \
  616.      IDL_NODE_TYPE(a) == IDLN_TYPE_WIDE_CHAR ||    \
  617.      IDL_NODE_TYPE(a) == IDLN_TYPE_FIXED ||        \
  618.      IDL_NODE_TYPE(a) == IDLN_TYPE_FLOAT ||        \
  619.      IDL_NODE_TYPE(a) == IDLN_TYPE_BOOLEAN ||    \
  620.      IDL_NODE_TYPE(a) == IDLN_TYPE_OCTET ||        \
  621.      IDL_NODE_TYPE(a) == IDLN_TYPE_ANY ||        \
  622.      IDL_NODE_TYPE(a) == IDLN_TYPE_OBJECT ||    \
  623.      IDL_NODE_TYPE(a) == IDLN_TYPE_TYPECODE ||    \
  624.      IDL_NODE_TYPE(a) == IDLN_TYPE_ENUM ||        \
  625.      IDL_NODE_TYPE(a) == IDLN_TYPE_ARRAY ||        \
  626.      IDL_NODE_TYPE(a) == IDLN_TYPE_SEQUENCE ||    \
  627.      IDL_NODE_TYPE(a) == IDLN_TYPE_STRUCT ||    \
  628.      IDL_NODE_TYPE(a) == IDLN_TYPE_UNION)
  629. #define IDL_NODE_IS_SCOPED(a)                \
  630.     (IDL_NODE_TYPE(a) == IDLN_IDENT ||        \
  631.      IDL_NODE_TYPE(a) == IDLN_INTERFACE ||        \
  632.      IDL_NODE_TYPE(a) == IDLN_MODULE ||        \
  633.      IDL_NODE_TYPE(a) == IDLN_EXCEPT_DCL ||        \
  634.      IDL_NODE_TYPE(a) == IDLN_OP_DCL ||        \
  635.      IDL_NODE_TYPE(a) == IDLN_TYPE_ENUM ||        \
  636.      IDL_NODE_TYPE(a) == IDLN_TYPE_STRUCT ||    \
  637.      IDL_NODE_TYPE(a) == IDLN_TYPE_UNION)
  638.  
  639. typedef struct _IDL_ns *        IDL_ns;
  640.  
  641. struct _IDL_ns {
  642.     IDL_tree global;
  643.     IDL_tree file;
  644.     IDL_tree current;
  645.     GHashTable *inhibits;
  646.     GHashTable *filename_hash;
  647. };
  648. #define IDL_NS(a)            (*(a))
  649.  
  650. typedef enum {
  651.     IDL_INPUT_REASON_INIT,
  652.     IDL_INPUT_REASON_FILL,
  653.     IDL_INPUT_REASON_ABORT,
  654.     IDL_INPUT_REASON_FINISH
  655. } IDL_input_reason;
  656.  
  657. union IDL_input_data {
  658.     struct {
  659.         const char *filename;
  660.     } init;
  661.     struct {
  662.         char *buffer;
  663.         size_t max_size;
  664.     } fill;
  665. };
  666.  
  667. typedef int        (*IDL_input_callback)        (IDL_input_reason reason,
  668.                              union IDL_input_data *data,
  669.                              gpointer user_data);
  670.  
  671. typedef int        (*IDL_msg_callback)        (int level,
  672.                              int num,
  673.                              int line,
  674.                              const char *filename,
  675.                              const char *message);
  676.  
  677. typedef struct _IDL_tree_func_state    IDL_tree_func_state;
  678. typedef struct _IDL_tree_func_data    IDL_tree_func_data;
  679.  
  680. #define IDL_WalkF_TypespecOnly    (1<<0)
  681.  
  682. /* Traversal state data.  Recursive walks chain states. */
  683. struct _IDL_tree_func_state {
  684.     IDL_tree_func_state *up;
  685.     IDL_tree start;
  686.     IDL_tree_func_data *bottom;
  687.     glong    flags;
  688. };
  689.  
  690. /* This holds a list of the up hierarchy traversed, beginning from traversal.  This is
  691.  * useful since nodes referenced after initial definition will have a different traversal
  692.  * path than the actual up path. */
  693. struct _IDL_tree_func_data {
  694.     IDL_tree_func_state *state;
  695.     IDL_tree_func_data *up;
  696.     IDL_tree tree;
  697.     gint step;
  698.     gpointer data;        /* Application data */
  699.     gint level;
  700. };
  701.  
  702. typedef gboolean    (*IDL_tree_func)        (IDL_tree_func_data *tnfd,
  703.                              gpointer user_data);
  704.  
  705. extern IDL_tree        IDL_check_type_cast        (const IDL_tree var,
  706.                              IDL_tree_type type,
  707.                              const char *file,
  708.                              int line,
  709.                              const char *function);
  710.  
  711. extern const char *    IDL_get_libver_string        (void);
  712.  
  713. extern const char *    IDL_get_IDLver_string        (void);
  714.  
  715. extern int        IDL_parse_filename        (const char *filename,
  716.                              const char *cpp_args,
  717.                              IDL_msg_callback msg_cb,
  718.                              IDL_tree *tree, IDL_ns *ns,
  719.                              unsigned long parse_flags,
  720.                              int max_msg_level);
  721.  
  722. extern int        IDL_parse_filename_with_input    (const char *filename,
  723.                              IDL_input_callback input_cb,
  724.                              gpointer input_cb_user_data,
  725.                              IDL_msg_callback msg_cb,
  726.                              IDL_tree *tree, IDL_ns *ns,
  727.                              unsigned long parse_flags,
  728.                              int max_msg_level);
  729.  
  730. extern int        IDL_ns_prefix            (IDL_ns ns,
  731.                              const char *s);
  732.  
  733. extern void        IDL_ns_ID            (IDL_ns ns,
  734.                              const char *s);
  735.  
  736. extern void        IDL_ns_version            (IDL_ns ns,
  737.                              const char *s);
  738.  
  739. extern int        IDL_inhibit_get            (void);
  740.  
  741. extern void        IDL_inhibit_push        (void);
  742.  
  743. extern void        IDL_inhibit_pop            (void);
  744.  
  745. extern IDL_tree        IDL_file_set            (const char *filename,
  746.                              int line);
  747.  
  748. extern void        IDL_file_get            (const char **filename,
  749.                              int *line);
  750.  
  751. extern IDL_tree        IDL_get_parent_node        (IDL_tree p,
  752.                              IDL_tree_type type,
  753.                              int *scope_levels);
  754.  
  755. extern IDL_tree        IDL_tree_get_scope        (IDL_tree p);
  756.  
  757. extern int        IDL_tree_get_node_info        (IDL_tree tree,
  758.                              char **who,
  759.                              char **what);
  760.  
  761. extern void        IDL_tree_error            (IDL_tree p,
  762.                              const char *fmt,
  763.                              ...)
  764.                             G_GNUC_PRINTF (2, 3);
  765.  
  766. extern void        IDL_tree_warning        (IDL_tree p,
  767.                              int level,
  768.                              const char *fmt,
  769.                              ...)
  770.                             G_GNUC_PRINTF (3, 4);
  771.  
  772. extern const char *    IDL_tree_property_get        (IDL_tree tree,
  773.                              const char *key);
  774.  
  775. extern void        IDL_tree_property_set        (IDL_tree tree,
  776.                              const char *key,
  777.                              const char *value);
  778.  
  779. extern gboolean        IDL_tree_property_remove    (IDL_tree tree,
  780.                              const char *key);
  781.  
  782. extern void        IDL_tree_properties_copy    (IDL_tree from_tree,
  783.                              IDL_tree to_tree);
  784.  
  785. extern void        IDL_tree_remove_inhibits    (IDL_tree *tree,
  786.                              IDL_ns ns);
  787.  
  788. extern void        IDL_tree_walk            (IDL_tree p,
  789.                              IDL_tree_func_data *current,
  790.                              IDL_tree_func pre_tree_func,
  791.                              IDL_tree_func post_tree_func,
  792.                              gpointer user_data);
  793.  
  794. extern void        IDL_tree_walk2            (IDL_tree p,
  795.                              IDL_tree_func_data *current,
  796.                              glong flags,
  797.                              IDL_tree_func pre_tree_func,
  798.                              IDL_tree_func post_tree_func,
  799.                              gpointer user_data);
  800.  
  801. extern void        IDL_tree_walk_in_order        (IDL_tree p,
  802.                              IDL_tree_func tree_func,
  803.                              gpointer user_data);
  804.  
  805. extern void        IDL_tree_free            (IDL_tree root);
  806.  
  807. extern void        IDL_tree_to_IDL            (IDL_tree p,
  808.                              IDL_ns ns,
  809.                              FILE *output,
  810.                              unsigned long output_flags);
  811.  
  812. extern GString *    IDL_tree_to_IDL_string        (IDL_tree p,
  813.                              IDL_ns ns,
  814.                              unsigned long output_flags);
  815.  
  816. extern gboolean        IDL_tree_contains_node        (IDL_tree p,
  817.                              IDL_tree searchNode);
  818.  
  819. extern gboolean     IDL_tree_is_recursive        (IDL_tree tree,
  820.                              gpointer dummy);
  821.  
  822. extern gchar *        IDL_do_escapes            (const char *s);
  823.  
  824. extern IDL_tree        IDL_resolve_const_exp        (IDL_tree p,
  825.                              IDL_tree_type type);
  826.  
  827. extern IDL_ns        IDL_ns_new            (void);
  828.  
  829. extern void        IDL_ns_free            (IDL_ns ns);
  830.  
  831. extern IDL_tree        IDL_ns_resolve_this_scope_ident    (IDL_ns ns,
  832.                              IDL_tree scope,
  833.                              IDL_tree ident);
  834.  
  835. extern IDL_tree        IDL_ns_resolve_ident        (IDL_ns ns,
  836.                              IDL_tree ident);
  837.  
  838. extern IDL_tree        IDL_ns_lookup_this_scope    (IDL_ns ns,
  839.                              IDL_tree scope,
  840.                              IDL_tree ident,
  841.                              gboolean *conflict);
  842.  
  843. extern IDL_tree        IDL_ns_lookup_cur_scope        (IDL_ns ns,
  844.                              IDL_tree ident,
  845.                              gboolean *conflict);
  846.  
  847. extern IDL_tree        IDL_ns_place_new        (IDL_ns ns,
  848.                              IDL_tree ident);
  849.  
  850. extern void        IDL_ns_push_scope        (IDL_ns ns,
  851.                              IDL_tree ident);
  852.  
  853. extern void        IDL_ns_pop_scope        (IDL_ns ns);
  854.  
  855. extern IDL_tree        IDL_ns_qualified_ident_new    (IDL_tree nsid);
  856.  
  857. extern gchar *        IDL_ns_ident_to_qstring        (IDL_tree ns_ident,
  858.                              const char *join,
  859.                              int scope_levels);
  860.  
  861. extern int        IDL_ns_scope_levels_from_here    (IDL_ns ns,
  862.                              IDL_tree ident,
  863.                              IDL_tree parent);
  864.  
  865. extern gchar *        IDL_ns_ident_make_repo_id    (IDL_ns ns,
  866.                              IDL_tree p,
  867.                              const char *p_prefix,
  868.                              int *major,
  869.                              int *minor);
  870.  
  871. #ifdef __cplusplus
  872. }
  873. #endif
  874.  
  875. #endif /* __IDL_H */
  876.